<!-- 相当于给模板定义一个名字 define end 成对出现 -->
{{ define "backstage/mine.html" }}
    <div class="content">
        <div class="opt-tip" id="tip"></div>
        <div class="cont-top">我的&nbsp;>></div>
        <div class="cont-bot">
            <div class="myInfo">
                <div class="it">用户名：{{.info.Name}}</div>
                <div class="it">性别：{{if eq .info.Sex 1}}男{{else if eq .info.Sex 2}}女{{end}}</div>
                <div class="it">年龄：{{.info.Age}}</div>
                <div class="it">地址：{{.info.Address}}</div>
                <div class="bot-btn">
                    <button class="change btn" onclick="changePassword()">修改密码</button>
                    <button class="exit btn" onclick="exitLg()">退出登录</button>
                </div>
            </div>
        </div>
    </div>

    <script>
        init();
        function init(){
            // 初始化操作提示
            let showTag={{.errTag}};
            let element = document.getElementById("tip");
            if (showTag==1){
                element.style.color="green";
                element.innerText="操作成功！";
                setTimeout(() => {
                    element.style.display="none";
                }, 3000);
            } else if (showTag==-1){
                element.style.color="red";
                element.innerText="操作失败！";
                setTimeout(() => {
                    element.style.display="none";
                }, 3000);
            } else {
                element.style.display="none";
            }
        }

        function changePassword(){
            location.href="/back/mine/changePassword";
        }
        function exitLg(){
            location.href="/back/login";
        }
    </script>

    <style>
        .content{
            margin: 10px;
            font-size: 14px;
            position: relative;
            .opt-tip{
                position: absolute; /* 绝对定位 */
                top: 50%; /* 相对于父容器垂直居中 */
                left: 50%; /* 相对于父容器水平居中 */
                transform: translate(-50%, -50%); /* 微调位置以精确居中 */
                z-index: 10; /* 确保悬浮块在主块之上 */
                font-size: 18px;
                border: 1px solid white;
                border-radius: 10px;
                padding: 10px;
                background-color: #ffa54f;
            }
            .cont-top{
                color: rgb(210, 56, 153);
                font-weight: bold;
                margin-bottom: 20px;
            }
            .cont-bot{
                display: grid;
                place-items: center;
                height: 60vh;
                .myInfo{
                    background-color: cadetblue;
                    padding: 30px;
                    font-size: 16px;
                    width: 40vh;
                    .it{
                        margin-bottom: 20px;
                    }
                    .bot-btn{
                        text-align: center;
                        .btn {
                            border: 1px solid white;
                            border-radius: 10px;
                            background-color: white;
                            font-weight: bold;
                            padding: 5px;
                            cursor: pointer;
                            font-size: 15px;
                        }
                        .change{
                            color: rgb(95, 201, 41);
                            margin-right: 40px;
                        }
                        .exit{
                            color: rgb(190, 65, 65);
                        }
                    }
                }
            }
        }
    </style>
{{ end }}